import { ref } from 'vue';
import { FormRule } from 'tdesign-vue-next';

export const INIT_DATA: any = { enable: false, server_adr: '', server_port: '', username: '', password: '' };

export const list = ref([
  { label: 'FTP启用禁用', value: false, key: 'enable', type: 'SwitchView' },
  { label: '服务器地址', value: '', key: 'server_adr', type: 'InputView', placeholder: '请输入服务器地址', clearable: true },
  { label: '用户名', value: '', key: 'username', type: 'InputView', placeholder: '请输入用户名', clearable: true },
  { label: '端口号', value: '', key: 'server_port', type: 'InputView', placeholder: '请输入端口号', clearable: true },
  { label: '密码', value: '', key: 'password', type: 'InputView', inputType: 'password', placeholder: '请输入密码', clearable: true },
]);

export const FORM_RULES: Record<string, FormRule[]> = {
  enable: [{ required: true, message: '请选择', trigger: 'blur' }],
  server_adr: [{ required: true, message: '请输入目标服务器地址', trigger: 'blur' }],
  server_port: [{ required: true, message: '请输入目标服务器端口', trigger: 'blur' }],
};
